import { post, postForm } from './service-base';

export const queryRaceInfoPage = (params: {
  pageNo: number;
  pageSize: number;
}) => {
  return post('/starsports/race/queryRaceInfoPage', params).then(comak);
};

export const publishRaceInfo = (params: { raceId: number }) => {
  return post('/starsports/race/publishRaceInfo', params).then(comak);
};

// 创建赛事
export const raceSaveBasicInfo = (params: any) => {
  return postForm('/starsports/race/saveRaceInfo', params).then(comak);
};

// 手机号验证
export const raceVerifySmsCode = (params: any) => {
  return post('/starsports/user/verifySmsCode', params).then(comak);
};

function comak(res) {
  if (!res?.data?.success) {
    return Promise.reject(res?.data?.message);
  }
  return res?.data;
}
